package com.ikun.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ikun.service.UserService;
import com.ikun.util.Result;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * @ClassName: AdminOwnerController
 * @Author: 吴思伟
 * @CreateTime: 2025-03-26 14:17
 * @Description: TODO
 */

@Controller
@RequestMapping("/admin/owner")
@Tag(name = "管理员模块", description = "管理员业主相关接口")
public class AdminOwnerController {
    @Autowired
    private UserService userService;

    @PostMapping("/all")
    @ResponseBody
    public Result showAllOwner() {
        return Result.success(userService.findAllOwner());
    }

    @GetMapping("/count")
    @ResponseBody
    public Result showCountAllOwner() {
        return Result.success(userService.countAllUsers());
    }

    @GetMapping("/detail")
    @ResponseBody
    public Result showAllOwnerDetail() {
        return Result.success(userService.findAllOwnerDetail());
    }

    @GetMapping("/detailById")
    @ResponseBody
    @Operation(summary = "根据管家id查询业主信息所有信息", description = "包括缴费")
    public Result showAllOwnerDetailByManagerId(Integer id) {
        return Result.success(userService.findAllOwnerDetailByManagerId(id));
    }

    @GetMapping("/infoById")
    @ResponseBody
    @Operation(summary = "根据管家id查询业主信息", description = "不包括缴费")
    public Result showAllOwnerInfoByManagerId(Integer id) {
        return Result.success(userService.findAllOwnerInfoByManagerId(id));
    }
}
